#ifndef UTILS_PAGESIZE_H
#define UTILS_PAGESIZE_H

#include <asm/utils/pagesize.h>

/* to align the pointer to the (next) page boundary */
#define PAGE_ALIGN(addr) ALIGN(addr, UTILS_PAGE_SIZE)
#define PAGE_ALIGN_DOWN(addr) ALIGN_DOWN(addr, UTILS_PAGE_SIZE)

/* test whether an address (unsigned long or pointer) is aligned to UTILS_PAGE_SIZE */
#define PAGE_ALIGNED(addr)	IS_ALIGNED((unsigned long)(addr), UTILS_PAGE_SIZE)

#define offset_in(p, a)     ((unsigned long)(p) & (a))
#define offset_in_page(p)   offset_in(p, ~UTILS_PAGE_MASK)

#endif /* !UTILS_PAGESIZE_H */
